package com.example.itcompanyinterview.container;

import java.util.List;
import java.util.Map;

import com.example.itcompanyinterview.R;
import com.example.itcompanyinterview.object.InterviewQuestion;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.RatingBar;
import android.widget.TextView;

public class QuestionRateAdapter extends ArrayAdapter<InterviewQuestion> {
	
	public QuestionRateAdapter(Activity activity, 
			List<InterviewQuestion> questionList, ListView listView) {
		super(activity, 0, questionList);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Activity activity = (Activity) getContext();
		
		View rowView = convertView;
		if(rowView == null) {
			LayoutInflater inflater = activity.getLayoutInflater();
            rowView = inflater.inflate(R.layout.question_item, null);
		}
		
		TextView questionTitleView = (TextView)rowView.findViewById(R.id.question);
		
		InterviewQuestion question = this.getItem(position);
		questionTitleView.setText(question.getTitle());
		
		return rowView;
	}
	
}
